
// RasterView.h : interface of the CRasterView class
//


#pragma once
#include "NX2DObjectBaseDef.h"


class CRasterView : public CView
{
protected: // create from serialization only
	CRasterView();
	DECLARE_DYNCREATE(CRasterView)

// Attributes
public:
	CRasterDoc* GetDocument() const;

// Operations
public:

// Overrides
public:
	virtual void OnDraw(CDC* pDC);  // overridden to draw this view
	virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
protected:
	virtual BOOL OnPreparePrinting(CPrintInfo* pInfo);
	virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo);
	virtual void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo);
	virtual int	 OnCreate(LPCREATESTRUCT lpcs);

	void		 MakeColorBuffer(int nWidth,int nHeight,float*pAlpha);
	void		 OnShape();
	void		 OnSetGPU();
	void		 OnSetCPU();

// Implementation
public:
	virtual ~CRasterView();
#ifdef _DEBUG
	virtual void AssertValid() const;
	virtual void Dump(CDumpContext& dc) const;
#endif

protected:

// Generated message map functions
protected:
	afx_msg void OnFilePrintPreview();
	afx_msg void OnRButtonUp(UINT nFlags, CPoint point);
	afx_msg void OnContextMenu(CWnd* pWnd, CPoint point);
	afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
	afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
	afx_msg void OnMouseMove(UINT nFlags, CPoint point);
	afx_msg BOOL OnEraseBkgnd(CDC* pDC);
	DECLARE_MESSAGE_MAP()


private:
	TPOUTLINEFIGURE m_Figure;
	DWORD*			m_pBuffer;
	int				m_nBuffWidth;
	int				m_nBuffHeight;
	CRect			m_rtRect;
	CRect			m_rtClickRect;
	CPoint			m_ptClick;

	BOOL			m_bUseGPU;
	int				m_nShapeType;
	int				m_bText;
	CString			m_str;

	void			releasefigure();
	void RenderGradientCenter( int nWidth, int nHeight );
	void RenderGradientCircle( int nWidth, int nHeight );
	void RenderGradientQuad( int nWidth, int nHeight );
	void RenderGradientTemplate( int nWidth ,int nHeight );
	void RenderTexture( int nWidth ,int nHeight );
	void RenderGradientCenterPolygon( int nWidth ,int nHeight );
	void RenderGradientOutLinePolygon( int nWidth ,int nHeight );
};

#ifndef _DEBUG  // debug version in RasterView.cpp
inline CRasterDoc* CRasterView::GetDocument() const
   { return reinterpret_cast<CRasterDoc*>(m_pDocument); }
#endif

